package controllers.interceptor;

import org.apache.commons.lang.StringUtils;

import play.mvc.Before;
import play.mvc.Http.Header;

import com.pany.domain.IConstant;
import com.pany.utils.SessionUtil;

import controllers.BaseController;

public class UserSecure extends BaseController
{
    @Before(unless = {"user.UserController.login", "catchAll"})
    static void authenticate()
    {
        Header sid = request.headers.get(IConstant.ISysConstant.SESSION_ID_NAME);
        if (sid == null || StringUtils.isEmpty(sid.value()) || !SessionUtil.checkSession(sid.value()))
        {
            renderFail(null, IConstant.ICommonResultCode.AUTH_FAIL);
        }
    }
    
}
